<template>
  <div class="centerRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <i class="iconfont icon-align-left"></i>
        </span>
        <span class="fs-xl text mx-2">抽蛋、留窝数量分析</span>
      </div>
      <div class="d-flex ai-center flex-column body-box">
        <dv-capsule-chart class="dv-cap-chart dv-cap-chart1" :config="config" />
        <dv-capsule-chart
          class="dv-cap-chart dv-cap-chart2"
          :config="config2"
        />
        <chart :data="eggValue" />
      </div>
    </div>
  </div>
</template>

<script>
import { defineComponent, reactive } from "vue";
import Chart from "./chart/index.tsx";

export default defineComponent({
  props: {
    dataValue: {
      type: Object,
      require: true,
    },
  },
  components: {
    Chart,
  },
  setup(props) {
    const eggValue = { ...props.dataValue };
    const config = reactive({
      data: [
        {
          name: "今日抽蛋",
          value: eggValue.whippingCount,
        },
        {
          name: "昨日抽蛋",
          value: eggValue.whippingCount - eggValue.diffWhippingCount,
        },
      ],
      colors: ["#37a2da", "#9fe6b8"],
    });

    const config2 = reactive({
      data: [
        {
          name: "今日留窝",
          value: eggValue.stayCount,
        },
        {
          name: "昨日留窝",
          value: eggValue.stayCount - eggValue.diffStayCount,
        },
      ],
      colors: ["#32c5e9", "#ffdb5c"],
    });

    return { config, config2, eggValue };
  },
});
</script>

<style lang="scss" scoped>
$box-height: 400px;
$box-width: 340px;
.centerRight1 {
  padding: 5px;
  height: $box-height;
  width: $box-width;
  border-radius: 5px;
  .bg-color-black {
    padding: 5px;
    height: $box-height;
    width: $box-width;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-cap-chart {
      width: 100%;
      // height: 100px;
    }
  }
  .dv-cap-chart1 {
  }

  :deep(.capsule-item) {
    margin: 3px 0px;
  }
}
</style>
